<template>
	<div class="word">
		<input type="search" placeholder="请输入书名,作者,出版社" required v-model="keywords" />
		<button type="button" @click="booksos">搜索</button>
	</div>
</template>

<script>
	export default {
		name: 'PCSearch',
		data() {
			return {
				keywords: '',
				books: [],
			}
		},
		methods: {
			booksos() {
				if (!this.keywords) {
					// 如果关键词为空，则不进行搜索  
					alert('请输入搜索关键词！');
					return;
				}
				// this.$store.state.findkey = this.keywords;
				this.$router.push('/pc/booklist?key=' + this.keywords);
			},
		},
	}
</script>

<style scoped>
	.word {
		width: 100%;
		height: 100%;
		display: flex;
	}

	.word input[type='search'] {
		width: 50%;
		height: 40px;
		border-radius: 6px;
		/* flex: 1; */
		text-indent: 0.5em;
		outline: none;
	}

	.word button {
		border-radius: 6px;
		border: none;
		width: 15%;
		height: 40px;
		color: white;
		background-color: #1e90ff;
	}
</style>